package com.jiyun.service.impl;

import com.jiyun.pojo.ThComplaint;
import com.jiyun.pojo.ThShop;
import com.jiyun.mapper.ThShopMapper;
import com.jiyun.pojo.ThTour;
import com.jiyun.service.IThComplaintService;
import com.jiyun.service.IThOrderService;
import com.jiyun.service.IThShopService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jiyun.service.IThTourService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * <p>
 *  展示今日新增客诉
 * </p>
 *
 * @author usian
 * @since 2022-10-27
 */
@Service
public class ThShopServiceImpl extends ServiceImpl<ThShopMapper, ThShop> implements IThShopService {

    @Autowired
    private IThComplaintService thComplaintService;
    @Autowired
    private IThTourService thTourService;
    @Override
    public Map<String, Object> newks() {
        //查询今日新增客诉
        List<ThComplaint> list = thComplaintService.list();
        Date date = new Date();
        int count=0;
        for (ThComplaint thComplaint : list) {
            if (thComplaint.getComplaintTime()==date){
                count++;
            }
        }
        Map<String,Object> map=new HashMap<>();
        map.put("今日新增客诉为:",count);

        //查询今日巡店任务
        List<ThTour> thTourList = thTourService.list();
        int xd=0;
        for (ThTour thTour : thTourList) {
            if (thTour.getNewTime()==date){
               xd++;
            }
        }
        map.put("今日新增巡店任务为",xd);
        return map;



    }
}
